package com.lu.http.json;

import com.squareup.moshi.FromJson;

class MapAdapter {
    @FromJson
    fun fromJsonAny(value: Any): Any {
        if (value is Number) {
            val str = value.toString()
            val dbNum = value.toDouble()
            if (!str.contains(".")
                || str.endsWith(".0")
            ) {
                if (dbNum < Integer.MAX_VALUE) {
                    return dbNum.toInt()
                }
            }
        }
        return value
    }
}